-- CALC_SKY_INSTANCE_PASS_BONUS

-- 计算天空副本通关奖励
-- @param user      玩家对象
-- @param bonusArg  奖励参数，即dungeon_element.csv表的args字段中配置的bonus_arg
return function(user, bonusArg)
    -- 如果对应建筑有天空勋章的奖励且未领取过勋章，直接替换
    if type(bonusArg) == "table" and
       type(bonusArg["sky_medal"]) == "number" then
        local skyMedal = bonusArg["sky_medal"];
        if SkyRelicFunctionM.isServerSkyMedalOpen() and not SkyRelicFunctionM.isOpenMedalFunction(skyMedal) then
            return { 1, skyMedal, 1 };
        end
    end

    if type(bonusArg) == "table" and
       type(bonusArg["id"]) == "number" then
        return SkyInstanceM.calcInstanceBonus(bonusArg["id"]);
    end
    return {};
end